function U_matrix = State2U_matrix(currentStates,u)

x = currentStates(1:3);

r1=sqrt((x(1)+u)^2+x(2)^2+x(3)^2);
r2=sqrt((x(1)-(1-u))^2+x(2)^2+x(3)^2);
%[] Position of the spacecraft WRT first and second primary bodies.

UXX=1-(1-u)*(1/(r1^3)-3*((x(1)+u)^2)/(r1^5))-u*(1/(r2^3)-3*((x(1)-(1-u))^2)/(r2^5));
UYY=1-(1-u)*(1/(r1)^3-3*x(2)^2/r1^5)-u*(1/r2^3-3*x(2)^2/r2^5);
UZZ=(-1)*(1-u)*(1/(r1)^3-3*x(3)^2/r1^5)-u*(1/r2^3-3*x(3)^2/r2^5);
UXY=3*(1-u)*x(2)*(x(1)+u)/r1^5+3*u*x(2)*(x(1)-(1-u))/r2^5;
UXZ=3*(1-u)*x(3)*(x(1)+u)/r1^5+3*u*x(3)*(x(1)-(1-u))/r2^5;
UYZ=3*(1-u)*x(2)*x(3)/r1^5+3*u*x(2)*x(3)/r2^5;
%[] Define all terms

UZY=UYZ;
UYX=UXY;
UZX=UXZ;
%[] Set the symmetric terms.

U_matrix=[...
          UXX, UXY, UXZ;
          UYX, UYY, UYZ;
          UZX, UZY, UZZ...
                        ];
%[] Determine the U Matrix.


end